package com.example.study.design.proxy;

import com.example.study.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 静态代理类
 *
 * @author duckquan
 */
@Component
public class UserProxy implements UserService {

    @Autowired
    private UserService userService;

    @Override
    public boolean deleteById(String id) {
        //扩展额外功能
        System.out.println("开启事务");
        boolean flag = userService.deleteById(id);
        System.out.println("提交事务");
        return flag;
    }
}
